import { ApiProperty } from '@nestjs/swagger';
import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
  OneToMany,
  // OneToOne,
  // OneToMany,
} from 'typeorm';
import { Question } from '../question/question.entity';

@Entity()
export class ExamEntity {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  @ApiProperty({ type: 'string', example: 'react' })
  exam_name: string;

  @Column()
  @ApiProperty({ type: 'string', example: 'react-dom' })
  exam_type_id: string;

  @OneToMany(() => Question, (question) => question.exam)
  questions: Question[];

  @CreateDateColumn({
    type: 'datetime',
    comment: '创建时间',
    name: 'create_at',
  })
  createAt: Date;

  @UpdateDateColumn({
    type: 'datetime',
    comment: '更新时间',
    name: 'update_at',
  })
  updateAt: Date;
}
